class FireAxeW extends AxeW;

#exec OBJ LOAD FILE=SimHostOrgTex.utx
//#exec OBJ LOAD FILE=WTFSledge.ukx

var float NextIronTime;
//var float NextReloadTime; //oh, I have plans...
//var mesh imposter;

replication
{
	reliable if(Role < ROLE_Authority)
		DoLunge;
}

/*
simulated function PostBeginPlay()
{
	// Weapon will handle FireMode instantiation
	Super.PostBeginPlay();

	imposter=SkeletalMesh'WTFSledge.Sledge';
	LinkMesh(imposter,true);
	BoneRefresh();
	SetDrawScale(50.0);
}
*/

simulated function Timer()
{
	Super.Timer();
	if (Instigator != None && ClientState == WS_Hidden)
	{
		LightType = LT_None;
	}
	else
		LightType = LT_SubtlePulse;
}

simulated exec function ToggleIronSights()
{
	local KFPlayerReplicationInfo KFPRI;
	
	//this functionality is available to berserkers only
	KFPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
	if (KFPRI == none || KFPRI.ClientVeteranSkill != Class'SRVetBerserker')
		return;

	if (
		NextIronTime <= Level.TimeSeconds &&
		!FireMode[0].bIsFiring && FireMode[0].NextFireTime < Level.TimeSeconds &&
		!FireMode[1].bIsFiring && FireMode[1].NextFireTime < Level.TimeSeconds
		)
	{
		if (Instigator != none && Instigator.Physics != PHYS_Falling)
		{
			DoLunge();
			if (ROLE < ROLE_AUTHORITY) //client-side fx, essentially
				FireMode[0].ModeDoFire();
				
			NextIronTime=Level.TimeSeconds+3.0;
		}
	}
}

simulated function DoLunge()
{
	local rotator VR; //ViewRotation
	local vector DirMomentum;
	local KFPlayerReplicationInfo KFPRI;

	KFPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
	VR = Instigator.Controller.GetViewRotation();
	if(KFPRI.ClientVeteranSkillLevel==11)
	{
		DirMomentum.X= 345.0;
		DirMomentum.Y= 0.0;
		DirMomentum.Z= 295.0; //325.0; //default kfhumanpawn jump height
	}
	if(KFPRI.ClientVeteranSkillLevel>=12)
	{
		DirMomentum.X= 475.0;
		DirMomentum.Y= 0.0;
		DirMomentum.Z= 340.0; //325.0; //default kfhumanpawn jump height
	}
	VR.Pitch=0;
	FireMode[0].ModeDoFire();
	Instigator.AddVelocity(DirMomentum >> VR);
}
simulated event WeaponTick(float dt)
{
	local KFPlayerReplicationInfo KFPRI;
	KFPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
	if(KFPRI.ClientVeteranSkillLevel<11 && !KFPRI.bAdmin)
	{
		Destroy();
	}
	Super.Weapontick(dt);
}

defaultproperties
{
     BloodyMaterialRef="SimHostOrgTex.Fireaxe.Fireaxe_bloody"
     SkinRefs(0)="SimHostOrgTex.Fireaxe.Fireaxe"
     FireModeClass(0)=Class'PerksSimHostOrg.FireAxeWFireB'
     FireModeClass(1)=Class'PerksSimHostOrg.FireAxeWFire'
     Description="A Firebug's special melee combat weapon"
     Priority=7
     PickupClass=Class'PerksSimHostOrg.FireAxeWPickup'
     AttachmentClass=Class'PerksSimHostOrg.FireAxeWAttachment'
     ItemName="FIRE Axe"
     LightType=LT_None
     LightSaturation=0
     LightBrightness=100.000000
     bDynamicLight=True
     AmbientGlow=10
}
